﻿using System;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Xc.DataAccess.OneNetCore.Services
{
    /// <summary>
    /// 查询设备请求
    /// </summary>
    public class QueryDevicesRequest : RequestCore<QueryDevicesRespond>
    {
        protected internal override string RequestPath 
        {
            get
            {
                var path= $"devices";
                return path;
            }
        }
        protected internal override HttpMethod HttpMethod => HttpMethod.Get;
        protected internal override bool SendBody => false;
        /// <summary>
        /// 设备在线状态
        /// </summary>
        [JsonPropertyName("online")]
        public bool? IsOnline { get; set; }
        /// <summary>
        /// 关键词
        /// </summary>
        [JsonPropertyName("key_words")]
        public string? KeyWords { get; set; }
        /// <summary>
        /// 指定页码，最大页数为10000
        /// </summary>
        [JsonPropertyName("page")]
        public int? Page { get; set; }
        [JsonIgnore]
        public string[] DeviceIds { get; set; }
        /// <summary>
        /// 指定设备ID，多个用逗号分隔，最多100个
        /// </summary>
        [JsonPropertyName("device_id")]
        public string DevcieId => DeviceIds == null ? null : string.Join(',', DeviceIds);
        /// <summary>
        /// 指定每页输出设备个数，默认30，最多100
        /// </summary>
        [JsonPropertyName("per_page")]
        public int? PageSize { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        [JsonPropertyName("begin")]
        public DateTime? BeginDateTime { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        [JsonPropertyName("end")]
        public DateTime? EndDateTime { get; set; }
    }

}
